package com.shangcheng.model.vo;


import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.CollUtil;
import com.shangcheng.model.domain.UmsMenu;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.io.Serializable;
import java.util.Date;
import java.util.List;

@Data
@AllArgsConstructor
@NoArgsConstructor
public class UmsMenuVo implements Serializable {
    private Integer id;
    private Integer parentId;
    private Date createTime;
    private String title;
    private Integer level;
    private Integer sort;
    private String name;
    private String icon;
    private Integer hidden;
    private List<UmsMenu> children;

    public static UmsMenuVo init(UmsMenu umsMenu, List<UmsMenu> childrens) {
        UmsMenuVo vo = new UmsMenuVo();
        if (CollUtil.isNotEmpty(childrens)){
            vo.setChildren(childrens);
        }
        BeanUtil.copyProperties(umsMenu, vo);
        return vo;
    }
}